﻿<!DOCTYPE html>
<html lang="zh">

<head resource>
    <meta charset="utf-8">
    <include file="../inc/meta.inc" />
    <title>给学员添加课程</title>
</head>

<body>
    <div id="vapp" v-cloak>
        <loading v-if="loading_init">加载中...</loading>
        <div v-else-if="!isexist">
            学员不存在！
        </div>
        <el-form ref="formdata" v-else :model="formdata" :rules="rules" @submit.native.prevent label-width="100px">
            <el-form-item label="学员">
                <div class="accinfo">
                    <img v-if="!!account.Ac_Photo && account.Ac_Photo!=''" :src="account.Ac_Photo" />
                    <img v-else-if="account.Ac_Sex==2" src="/Utilities/images/head2.jpg" />
                    <img v-else src="/Utilities/images/head1.jpg" />
                    <div class="acc-name">
                        <span v-if="account.Ac_Name!=''">{{account.Ac_Name}}</span>
                        <span v-else>（没有名字）</span>
                        <span class="acc-acname">({{account.Ac_AccName}})</span>
                    </div>
                </div>
            </el-form-item>
            <el-form-item label="学习时限" prop="limittime">
                <el-date-picker type="daterange" v-model="formdata.limittime" :picker-options="pickerOptions"
                    start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['12:00:00']">
                </el-date-picker>
                <help>课程可以学习的时间区间</help>
            </el-form-item>
            <el-form-item label="选择课程" prop="courses">
                <el-cascader ref="subjects" style="width: 400px;" clearable v-model="sbjids" placeholder="-- 请选择课程专业 --"
                    :options="subjects" separator="／" :props="defaultSubjectProps" filterable @change="changeSbj">
                    <template slot-scope="{ node, data }">
                        <span>{{ data.Sbj_Name }}</span>
                        <span class="sbj_course" v-if="data.Sbj_CouNumber>0">
                            <icon course></icon>{{ data.Sbj_CouNumber }}
                        </span>
                    </template>
                </el-cascader>
                <el-select @change="changeCourse" value-key="Cou_ID" style="width: 100%;" filterable
                    placeholder="-- 选择课程（可检索） --" clearable :multiple-limit="1">
                    <el-option v-for="(item,i) in courses" :key="item.Cou_ID" :label="item.Cou_Name" :value="item">
                        <span>{{i+1}} . </span>
                        <span>{{item.Cou_Name}}</span>
                    </el-option>
                </el-select>
            </el-form-item>
        </el-form>
        <div class="courselected">
            <template v-if="formdata.courses.length>0">
                <div v-for="(item,i) in formdata.courses" class="course">
                    <div class="cour_img">
                        <a target="_blank" :href="'/web/course/detail.'+item.Cou_ID">
                            <img :src="item.Cou_LogoSmall" v-if="item.Cou_LogoSmall!=''" />
                            <img src="/Utilities/images/cou_nophoto.jpg" v-else />
                        </a>
                        <span class="rec" v-if="item.Cou_IsRec"></span>

                    </div>
                    <div class="cour_name">
                        <span>{{i+1}}.</span>
                        <a target="_blank" :href="'/web/course/detail.'+item.Cou_ID"> {{item.Cou_Name}}</a>
                        <div class="subject" title="课程专业">
                            <a :href="'/web/Course?sbjid='+item.Sbj_ID" target="_blank">
                                <icon>&#xe750</icon>{{item.Sbj_Name}}
                            </a>
                        </div>
                    </div>

                    <div class="cour_btn">
                        <el-link icon="el-icon-delete" type="danger" @click="removeCourse(i)">取消选择</el-link>

                    </div>
                </div>
            </template>
            <help v-else>通过上方的下拉框选择课程</help>
        </div>
        <div class="footer">
            <el-button type="primary" native-type="submit" :loading="loading_up" plain @click="btnEnter('formdata')">
                <icon v-if="!loading_up">&#xa048</icon>保存操作
            </el-button>
            <el-button type='close'>
                取消
            </el-button>
        </div>
    </div>


</body>

</html>